import { http } from '@/utils/http/axios';
/**
 * @description: 获取积分配置
 */
export function getIntegralSetting() {
  return http.request({
    url: '/setting/integral/screen/get',
    method: 'get',
  });
}
/**
 * @description: 分页获取教师学生列表
 */
export function getTeacherStudentList(params) {
  return http.request({
    url: '/student/store/screen/page',
    method: 'get',
    params,
  });
}
/**
 * @description: 根据码点获取对应的教材区域信息
 */
export function getBookPageInfoByKey(params) {
  return http.request({
    url: '/textbook/page/common/getBookPageByKey',
    method: 'get',
    params,
  });
}
const tempKeys: any = [];
/**
 * @description: 获取当前页码所有区域信息
 */
// export function getPageRegionByKey(params) {
//   let key = JSON.stringify(params);
//   if (!tempKeys.includes(key)) {
//     tempKeys.push(key)
//     return http.request({
//       url: '/textbook/page/common/getBookPageRegionByKey',
//       method: 'get',
//       params,
//     });
//     const timer = setTimeout(() => {
//       let i = tempKeys.findIndex(key)
//       if (i > -1){
//         tempKeys.splice(i, 1)
//       }
//       clearTimeout(timer)
//     })
//   } else {
//     return true
//   }
// }
export function getPageRegionByKey(params) {
  return http.request({
    url: '/textbook/page/common/getBookPageRegionByKey',
    method: 'get',
    params,
  });
}
export interface StudentRecordInfo {
  age: number;
  birthday: string;
  courseCount: number;
  gender: number;
  id: number;
  learningStageId: number;
  learningStageName: string;
  name: string;
  pic: string;
  score: number;
  totalIntegral: number;
  wordCount: number;
}
/**
 * @description: 获取学员记录列表
 */
export function getStudentRecordList(params) {
  return http.request({
    url: '/student/record/analysis/screen/getStudentRecordPage',
    method: 'get',
    params,
  });
}
export interface CourseDateRecordInfo {
  courseDate: string;
  courseExerciseIds: string[] | number[];
}
/**
 * @description: 获取开课历史
 */
export function getCourseDateRecord(params) {
  return http.request({
    url: '/course/exercise/analysis/screen/getCourseHistory',
    method: 'get',
    params,
  });
}
/**
 * @description: 获取课堂学生练习汇总
 */
export function getCourseStudentExerciseList(params) {
  return http.request({
    url: '/course/exercise/analysis/screen/getCourseStudentExerciseList',
    method: 'get',
    params,
  });
}
/**
 * @description: 字迹评分
 */
export function preCompute(data) {
  return http.request({
    url: '/algorithm/common/preCompute',
    method: 'post',
    data,
    transformRequest: [
      function (data) {
        return data;
      },
    ],
  });
}
/**
 * @description: 字迹评分 预先提交
 */
export function beforePreCompute(data) {
  return http.request({
    url: '/algorithm/common/preSubmission',
    method: 'post',
    data,
    transformRequest: [
      function (data) {
        return data;
      },
    ],
  });
}
/**
 * @description: 获取预先提交的字迹评分
 */
export function getRealWordData(params) {
  return http.request({
    url: '/algorithm/common/queryComputeResult',
    method: 'get',
    params,
  }, {
    isTransformResponse: false,
  });
}
